// --------------------------------------------------------------------------------------------------------------------
// <copyright file="HostHeartbeatTest.cs" company="Microsoft Corporation">
// The MIT License (MIT)
// 
// Copyright (c) 2014, Microsoft Corporation
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Microsoft.Robotics.Hardware.EV4.UnitTests
{
    using System;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Test.Robotics.Hardware.DAC;

    /// <summary>
    /// Unit test the HostHeartbeat class
    /// </summary>
    [TestClass]
    public class HostHeartbeatTest
    {
        /// <summary>
        /// Unit test the HostHeartbeat constructor
        /// </summary>
        [Priority(0)]
        [TestMethod]
        [TestCategory("Unit")]
        public void TestContructor()
        {
            HostHeartbeat hostHeartbeat = new HostHeartbeat(40, 40);
            Assert.IsNotNull(hostHeartbeat);
        }

        /// <summary>
        /// Unit test the Cancel method
        /// </summary>
        [Priority(0)]
        [TestMethod]
        [TestCategory("Unit")]
        [ExpectedException(typeof(NotImplementedException), "An unhandled method call was allowed.")]
        public void TestCancel()
        {
            HostHeartbeat hostHeartbeat = new HostHeartbeat(40, 40);
            hostHeartbeat.Cancel();
        }

        /// <summary>
        /// Unit test the Parse Parameters method
        /// </summary>
        [Priority(0)]
        [TestMethod]
        [TestCategory("Unit")]
        public void TestParseParameters()
        {
            HostHeartbeat hostHeartbeat = new HostHeartbeat(40, 40);
            hostHeartbeat.ParseParameters(new MockReader(1024));
        }

        /// <summary>
        /// Unit test the ParseResponse method
        /// </summary>
        [Priority(0)]
        [TestMethod]
        [TestCategory("Unit")]
        [ExpectedException(typeof(NotImplementedException), "An unhandled method call was allowed.")]
        public void TestParseResponse()
        {
            HostHeartbeat hostHeartbeat = new HostHeartbeat(40, 40);
            hostHeartbeat.ParseResponse(new MockReader(1024));
        }

        /// <summary>
        /// Unit test the PrepareRequest method
        /// </summary>
        [Priority(0)]
        [TestMethod]
        [TestCategory("Unit")]
        public void TestPrepareRequest()
        {
            HostHeartbeat hostHeartbeat = new HostHeartbeat(40, 40);
            hostHeartbeat.PrepareRequest();
        }
    }
}
